home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
lisp
/
eulisp
/
mpfeel.lha
/
MPFeel
/
Plurals
/
MP_Context.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-05
|
3KB
|
84 lines
/*
* Plurals
*
* Author: S.C.Merrall
*
* File: MP_Context.h
*
* Contents: Object functions Start, Length and Offset
* The Lisplural structure
*
* Description: These are handles on a plural context. From this we
* find which processors are supposed to be active
* before we start operating with a plural.
*
* Change History:
*
* Date Name Comment
* -------- ---- -------
* 28:06:91 SCM Created - modified from MP_Plural.h
* 20:01:91 SCM onverted to work with proc_pair.h
* 08:04:92 SCM Modifications for GC - handles are chained.
* 07:06:92 SCM Added rectangle orientated macros
*
*/
typedef unsigned short natural;
struct MP_Context {
OD_COMMON_STRUCTURE;
object next;
natural offset;
natural width;
natural height;
natural br_x;
natural br_y;
};
extern struct MP_Context OC_MP_Context;
#ifdef OD_OBJECT_CHECK
#define OA_width(OBJECT) (error(OBJECT,"OA_width",OI_MP_Context)->MP_Context.width)
#define OA_height(OBJECT) (error(OBJECT,"OA_height",OI_MP_Context)->MP_Context.height)
#define OA_br_x(OBJECT) (error(OBJECT,"OA_br_x",OI_MP_Context)->MP_Context.br_x)
#define OA_br_y(OBJECT) (error(OBJECT,"OA_br_y",OI_MP_Context)->MP_Context.br_y)
#define OA_offset(OBJECT) (error(OBJECT,"OA_offset",OI_MP_Context)->MP_Context.offset)
#define OA_next(OBJECT) (error(OBJECT,"OA_offset",OI_MP_Context)->MP_Context.next)
#else
#define OA_width(OBJECT) (OBJECT->MP_Context.width)
#define OA_height(OBJECT) (OBJECT->MP_Context.height)
#define OA_br_x(OBJECT) (OBJECT->MP_Context.br_x)
#define OA_br_y(OBJECT) (OBJECT->MP_Context.br_y)
#define OA_offset(OBJECT) (OBJECT->MP_Context.offset)
#define OA_next(OBJECT) (OBJECT->MP_Context.next)
#endif
/* These structures have to be garbage collected - to avoid introducing
* another flag I am using the one inside the Generic info slot. This means
* we can't wrap error around the operation otherwise it will fail if
* the structure is already free.
*/
#define OM_not_free(OBJECT) (OBJECT->Generic.info)=(OBJECT->Generic.info&(OD_TYPE_MASK))
/* macro expands to conditional statement to execute code on a Contexts set
* of processors
*/
#define OM_with_context(o) if ((PP_ixproc >= ((1+ OA_br_x(o)) - OA_width(o))) && \
(PP_ixproc <= OA_br_x(o)) && \
(PP_iyproc >= ((1+ OA_br_y(o)) - OA_height(o))) && \
(PP_iyproc <= OA_br_y(o)))
#define OM_last(o) ((OA_br_y(o)*PP_nxproc)+OA_br_x(o))
#define OM_first(o) (((OA_br_y(o)-OA_height(o))*PP_nxproc)+OA_br_x(o)-OA_width(o)+PP_nxproc+1)
#define OM_bottom_edge(o) (OA_br_y(o)==PP_iyproc)
#define OM_right_edge(o) (OA_br_x(o)==PP_ixproc)
#define OM_top_edge(o) (((1+OA_br_y(o)) - OA_height(o))==PP_iyproc)
#define OM_left_edge(o) (((1+OA_br_x(o)) - OA_width(o))==PP_ixproc)